<script type="text/javascript">
$(function () {
	$('#editTempForm').find("input:checkbox, input:radio").not('input.ibtn').uniform();
});
</script>
<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div class="bg-light lter b-b wrapper-md">
	<h5 class="m-n font-thin h3">试卷模板</h5>
</div>
<form id="editTempForm" style="width: 600px;">
	<table class="table table-bordered animate2 fadeInUp" style="text-align:left;">
		<tr>
			<th style="width: 80px;">模板名称</th>
			<td>
				<input type="text" id="name" name="name" value="${(temp.name)!''}" />
				<input type="hidden" name="code" value="${(temp.code)!''}" />
			</td>
			<td rowspan="4">备注:<br><textarea class="form-control" style="resize: none;" id="remark" name="remark" rows="3">${(temp.remark)!''}</textarea></td>
		</tr>
		<!-- <tr>
			<th>是否屏蔽</th>
			<td><@mt.YesOrNo value="${(temp.deleted)!''}" r=true name='deleted' d=false mc=true /></td>
		</tr> -->
		<tr>
			<th>总分</th>
			<td>
				<span id="zf" style="font-size: 25px;color: red;">${(temp.score)!'0'}</span>
				<input type="hidden" id="score" name="score" value="${(temp.score)!'0'}"/>
			</td>
		</tr>
	</table>
	<table style="width:600px; margin-top:10px;" class="table table-bordered animate2 fadeInUp">
		<thead>
			<tr>
				<th style="text-align: center;">题目类型</th>
				<th style="text-align: center;">题目难度</th>
				<th style="text-align: center;">数量</th>
				<th style="text-align: center;">每题分值</th>
				<th style="text-align: center;">
					<a href="javascript:;" style="color: green;" onclick="javascript: addRow_temp(); return false">[增加]</a>
				</th>
			</tr>
		</thead>
		<tbody id="tby">
		<#assign i = 0 />
			<#if temp?? && temp.list??>
				<#list temp.list as item>
					<tr class="rep">
						<td><@mte.Problemtype s=true value="${(item.type)!''}" name="list[${i}].type" wid="120px;"/></td>
						<td><@mte.TopicDifficulty s=true value="${(item.lc)!''}" name="list[${i}].tdc" wid="120px;" onchange="sore_temp(${i});" i="${i}" id="select_${i}" nullstr="请选择"/></td>
						<td><input class="" type="text" onblur="javascript: totalInt_temp(); return false;" name="list[${i}].num" value="${(item.num)!''}" style="width: 60px;" />
							<input type="hidden" name="list[${i}].code" value="${(item.code)!''}" />
						</td>
						<td><input class="aa" id="sore_${i}" type="text" onblur="javascript: totalInt_temp(); return false;" name="list[${i}].point" value="${(item.point)!''}" style="width: 60px;" /></td>
						<td>
							<button class="btn btn-xs btn-danger" onclick="javascript: delRow_temp($(this)); return false;" title="删除">
								<i class="icon-remove"></i>
							</button>
						</td>
					</tr>
					<#assign i = i + 1 />
				</#list>
			</#if>
		</tbody>
		<tr>
			<td style="text-align: center;" colspan="5">
				<button class="btn btn-info" onclick="javascript: save_temp(); return false;"  title="保存"><i class="icon-save"></i>&nbsp;&nbsp;保存</button>&nbsp;&nbsp;&nbsp;
				<button class="btn btn-primary" onclick="javascript: sys_load_handle('temp'); return false;" title="取消">取消</button>
			</td>
		</tr>
	</table>
	
		<input type="hidden" id="index" value="${i}" />
</form>
<table id="cloneTable" style="display:none;">
	<tr class="rep">
		<td><@mte.Problemtype s=true wid="120px;"/></td>
		<td><@mte.TopicDifficulty s=true wid="120px;" onchange="sore_temp($(this));" nullstr="请选择"/></td>
		<td><input class="form-control ng-pristine ng-invalid ng-invalid-required" type="text" onblur="javascript: totalInt_temp(); return false;" style="width: 60px;" /></td>
		<td><input class="aa" type="text" onblur="javascript: totalInt_temp(); return false;" style="width: 60px;" /></td>
		<td>
			<button class="btn btn-sm btn-icon btn-danger" onclick="javascript: delRow_temp($(this)); return false;" title="删除">
				<i class="icon-remove"></i>
			</button>
		</td>
	</tr>
</table>